# coding:utf-8
from odoo import models, fields, api



class WarehouseId(models.Model):
    _name = 'res.partner'
    _inherit = 'res.partner'

    warehouse_id=fields.Many2one('stock.warehouse',u'xxx')

class WarehouseId(models.Model):
    _name='sale.order'
    _inherit="sale.order"

    @api.onchange('partner_id')
    def _partner_onchange(self):
        self.warehouse_id = self.partner_id.warehouse_id

    @api.multi
    @api.onchange('partner_id')
    def onchange_partner_id(self):
        super(WarehouseId,self).onchange_partner_id()
        self.update({'user_id':None})
        return {
            'domain': {'user_id': [('id', 'in', self.team_id.member_ids.ids)]},
        }


